Skip to content

fix(uri): treat the scheme case-insensitively - #587

Open
yuchengshen931122-creator wants to merge 1 commit into
python-validators:masterfrom
yuchengshen931122-creator:g33/fix-uri-scheme-case
Open

yuchengshen931122-creator wants to merge 1 commit into
python-validators:masterfrom
yuchengshen931122-creator:g33/fix-uri-scheme-case

Conversation

@yuchengshen931122-creator

Copy link
Copy Markdown

Fixes #584.

What

uri compared scheme prefixes on the raw value, so HTTP://EXAMPLE.COM and MAILTO:user@example.com were rejected although url accepts them. RFC 3986 §3.1: schemes are case-insensitive. The scheme (the part before the first :) is now lower-cased before dispatching; the rest of the value is untouched, so host, path and the e-mail address keep their case.

Tests

  • New: test_accepts_scheme_in_any_case (6 cases: http, https, mailto, file, telnet, urn) – fails on master, passes with this change.
  • Checked locally with the CI commands: uv run pytest . (1,580 passed), ruff format ., ruff check ., pyright . (0 errors).

Found while writing specification-based tests for a university software-testing project (NYCU). The change and this description were prepared with the help of an AI assistant (Claude Code).

🤖 Generated with Claude Code

`uri` compared scheme prefixes on the raw value, so `HTTP://EXAMPLE.COM`
was rejected although `url` accepts it. RFC 3986 3.1: schemes are
case-insensitive. Lower-case the scheme before dispatching.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

uri: upper-case schemes are rejected although url() accepts them (HTTP://EXAMPLE.COM)

1 participant